package com.dlc.beijingrfid.adapter;

import com.dlc.commonlibrary.adapter.BaseRecyclerAdapter;
import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.net.bean.RFIDListBean;

/**
 * Created by John on 2017/7/19.
 */

public class TagProductInfoAdapter<T extends RFIDListBean.DataBean.ListBean> extends BaseRecyclerAdapter<T> {

    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.item_product_info;
    }

    @Override
    public void onBindViewHolder(CommonHolder holder, int position) {
        T item = getItem(position);
        holder.setText(R.id.tv_rfid, item.getRFID());
        holder.setText(R.id.tv_name, item.getName());
        holder.setText(R.id.tv_spec, item.getSpec());
        holder.setText(R.id.tv_where, item.getWhere());
    }

    public String[] getRFIDs() {
        String[] rfids = new String[getItemCount()];
        for (int i = 0; i < mData.size(); i++) {
            rfids[i] = mData.get(i).getRFID();
        }
        return rfids;
    }
}
